<template>
  <div>
    <FormPanel ref="from" :list="formList" :isSubmitBtn="false" :collapse="false" :labelWidth="110" />

    <div style="height: 47px"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right',
      }"
    >
      <el-button @click="closeDrawer(1)">关 闭</el-button>
    </div>
  </div>
</template>
<script>
import { getDetail } from '@/api/omSaleP/OrderManagement/PurchaseOrder/index.js';
import { dictionary } from '@/utils/dictMixin';

export default {
  data() {
    this.saveData = null;
    return {
      formList: this.createdFrom(),
    };
  },
  mixins: [dictionary],
  created() {
    this.getDetail(this.rowData);
  },
  props: ['rowData'],
  components: {},
  methods: {
    createdFrom() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '订单信息',
        },

        {
          type: 'INPUT',
          label: '订单编号',
          fieldName: 'orderNo',
          placeholder: '请输入',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '结算订单编号',
          fieldName: 'doNo',
          placeholder: '请输入',
          disabled: true,
        },
        {
          type: 'SELECT',
          label: '订单明细状态',
          fieldName: 'orderStatus',
          disabled: true,
          placeholder: '请选择',
          itemList: this.createDictList('2109'),
        },
        {
          type: 'SELECT',
          label: '订单类型',
          fieldName: 'orderType',
          placeholder: '请选择',
          disabled: true,
          itemList: this.createDictList('2105'),
        },
        {
          type: 'INPUT',
          label: '订单细分类型',
          fieldName: 'orderDetailTypeName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '订单经销商',
          fieldName: 'dealerCode',
          placeholder: '请输入',
          disabled: true,
        },
        {
          type: 'SELECT',
          label: '紧急度',
          fieldName: 'emergencyType',
          placeholder: '请选择',
          disabled: true,
          itemList: this.createDictList('2101'),
        },
        {
          type: 'INPUT',
          label: '订单年月',
          fieldName: 'orderYearMonth',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'SELECT',
          label: '车辆用途',
          fieldName: 'vehicleUse',
          placeholder: '请选择',
          disabled: true,
          itemList: this.createDictList('2102'),
        },
        {
          type: 'SELECT',
          label: '运输方式',
          fieldName: 'transportType',
          placeholder: '请选择',
          disabled: true,
          itemList: this.createDictList('2409'),
        },
        {
          type: 'INPUT',
          label: '收车地址',
          fieldName: 'address',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '送达城市',
          fieldName: 'orderCity',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '联系人',
          fieldName: 'linkMan',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '联系电话',
          fieldName: 'linkPhone',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '物料编码',
          fieldName: 'productCode',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '物料描述',
          fieldName: 'productName',
          placeholder: '请选择',
          style: { width: 'calc(100% - 30px)' },
          disabled: true,
          descOptions: {
            isTooltip: true,
            content: this.rowData.productName,
            style: { left: '10px', float: 'right' },
          },
        },
        {
          type: 'INPUT',
          label: '车系',
          fieldName: 'seriesName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '车型',
          fieldName: 'modelName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '配置',
          fieldName: 'packageName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '选装',
          fieldName: 'optionName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '内饰',
          fieldName: 'trimName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '外饰',
          fieldName: 'colorName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          label: '资金类型',
          fieldName: 'accountTypeName',
          placeholder: '请选择',
          disabled: true,
        },
        {
          type: 'INPUT',
          precision: 2,
          numberFormat:true,
          label: '市场指导价',
          fieldName: 'singleAmount',
          disabled: true,
        },
        {
          type: 'INPUT',
          precision: 2,
          numberFormat:true,
          label: '现金折让',
          fieldName: 'discountAmount',
          disabled: true,
        },
        {
          type: 'INPUT',
          precision: 2,
          numberFormat:true,
          label: '建店返利',
          fieldName: 'buildRebateAmount',
          disabled: true,
        },
        {
          type: 'INPUT',
          precision: 2,
          numberFormat:true,
          label: '采购价格',
          fieldName: 'afterDiscountAmount',
          disabled: true,
        },
        {
          type: 'SELECT',
          label: '是否使用返利',
          fieldName: 'isRebate',
          placeholder: '请选择',
          disabled: true,
          itemList: this.createDictList('1004'),
          initialValue: 10041001,
        },
          {
          type: 'INPUT',
          precision: 2,
          numberFormat:true,
          label: '返利冲抵',
          fieldName: 'singleRebateAmount',
          disabled: true,
        },
      ];
    },
    async getDetail(data) {
      for (let i in data) {
        this.formList.map((x) => {
          if (x.fieldName == i) {
            x.initialValue = data[i];
          }
        });
      }
    },
    changeHandle(val) {
      this.saveData = val;
    },
    async closeDrawer(type) {
      if (type == 1) {
        this.$emit('close');
      }
    },
  },
};
</script>
<style lang="less">
.discount {
  text-decoration: underline;
  color: #d1291a;
  cursor: pointer;
}
</style>
